<? 
    session_start();
	include ("../core/conn.php");
	global $db;	
	$db = get_conn();
	
	$id_orden= $_GET['id_orden'];
			
	$sql = "select o.id_orden, u.fname, u.lname , o.fecha, o.total, o.terminada_time
			from ordenes o , users u 
			where 
			o.id_orden like '%".trim($id_orden)."%' and 
			o.id_user = u.id_user 
			 order by  o.id_orden asc ";
	
	$result = mysql_query($sql);
	if($result){
		$data.="<tr>
				<td class='cart_title'>#</td>
				<td class='cart_title'>Nombre</td>					
				<td class='cart_title'>Fecha</td>
				<td class='cart_title'>Hora</td>					
				<td class='cart_title'> Total</td>					
				</tr>";

		$cantidad = mysql_num_rows($result);
		if($cantidad > 0){
			while($row = mysql_fetch_array($result)){
				$data.="<tr>
						<td><a href='ver_orden.php?id=".$row['id_orden']."'>".$row['id_orden']."</td>
						<td>".$row['fname']." ".$row['lname']."</td>					
						<td>".format_date($row['fecha'])."</td>
						<td>".$row['terminada_time']."</td>					
						<td>".format($row['total'],"&cent;")."</td>					
						</tr>";
			}//while
		}else{
				$data.="<tr>
						<td align='center' colspan='5'>No hay Resultados</td>
						</tr>";			
			}
	}else{
		error_handling(__FUNCTION__.$sql,mysql_error());
	}

?>
<link href="../css/admin_styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<?php 		
	echo "<table align='center' width='100%' border='0'>".$data."</table>";
?>
